<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<%@ include file="/static/include/common.inc"%>
<link rel="stylesheet" href="static/admin/css/layui.css">
<link rel="stylesheet" href="static/layui_v2.2.3/css/zbyui.css">
<link rel="stylesheet" href="static/admin/css/main.css" media="all">
<script src="static/js/jquery-1.11.2.js"></script>
<script src="static/layui_v2.2.3/layui.js" charset="utf-8"></script>
</head>
<body>
	<ul class="layui-tab-title">
		<li class="layui-this">公交信息上传</li>
	</ul>
	<div class="layui-tab-content">
		<div class="layui-tab-item layui-show" style="margin: 10px">
			<div class="layui-upload">
				<form id="bus">
					<input type="file" name="file" width="120px">
				</form>
			</div>
		</div>
		<div class="layui-inline">
			<button class="layui-btn" onclick="upload()">上传</button>
		</div>
	</div>
	<script type="text/javascript">
		function upload() {
			var url = "admin/bus/upload.do;"
			var form = new FormData(document.getElementById("bus"));
			$.ajax({
				url : url,
				data : form,
				type : 'post',
				processData : false,
				contentType : false,
				error : function(data) {
					alert("文件上传失败");
				},
				success : function(data) {
					if (data.code == 0) {
						alert("文件上传成功");
					} else {
						alert(data.message);
					}
				}
			})
		}
	</script>
</body>
</html>